package testcase.validationtest;

import junit.framework.TestCase;
import validation.*;
import card.Card;
import card.Cardset;

public class FourWithDualPairTest extends TestCase{
	private Type aaaabbcc;
	private Cardset cardset;
	@Override
	public void setUp(){
		cardset = new Cardset(8);
		aaaabbcc = FourWithDualPair.getInstance();
	}
	@Override
	public void tearDown(){
		aaaabbcc.clear();
		aaaabbcc = null;
	}
	// testcases
	public void testCorr1(){
		cardset = new Cardset(8);
		cardset.clear();
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('c','A'));
		cardset.add(new Card('d','A'));
		cardset.add(new Card('s','3'));
		cardset.add(new Card('h','3'));
		cardset.add(new Card('s','4'));
		cardset.add(new Card('h','4'));
		assertEquals(FourWithDualPair.getInstance().identify(cardset), aaaabbcc);
	}
	public void testCorr2(){
		cardset = new Cardset(8);
		cardset.clear();
		cardset.add(new Card('s','2'));
		cardset.add(new Card('h','2'));
		cardset.add(new Card('c','2'));
		cardset.add(new Card('d','2'));
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('s','4'));
		cardset.add(new Card('h','4'));
		assertEquals(FourWithDualPair.getInstance().identify(cardset), aaaabbcc);
	}
	public void testInCorr1(){
		cardset = new Cardset(8);
		cardset.clear();
		cardset.add(new Card('s','2'));
		cardset.add(new Card('h','2'));
		cardset.add(new Card('c','3'));
		cardset.add(new Card('d','2'));
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('s','4'));
		cardset.add(new Card('h','4'));
		assertEquals(FourWithDualPair.getInstance().identify(cardset), null);
	}
	public void testInCorr2(){
		cardset = new Cardset(9);
		cardset.clear();
		cardset.add(new Card('s','2'));
		cardset.add(new Card('h','2'));
		cardset.add(new Card('c','2'));
		cardset.add(new Card('d','2'));
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('s','4'));
		cardset.add(new Card('h','4'));
		cardset.add(new Card('h','7'));
		assertEquals(FourWithDualPair.getInstance().identify(cardset), null);
	}
	public void testInCorr3(){
		cardset = new Cardset(8);
		cardset.clear();
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('s','4'));
		cardset.add(new Card('h','4'));
		cardset.add(new Card('s','2'));
		cardset.add(new Card('h','2'));
		cardset.add(new Card('c','2'));
		cardset.add(new Card('d','2'));
		assertEquals(FourWithDualPair.getInstance().identify(cardset), aaaabbcc);
	}
	public void testPrior(){
		cardset = new Cardset(8);
		cardset.add(new Card('s','2'));
		cardset.add(new Card('h','2'));
		cardset.add(new Card('c','2'));
		cardset.add(new Card('d','2'));
		cardset.add(new Card('s','A'));
		cardset.add(new Card('h','A'));
		cardset.add(new Card('s','4'));
		cardset.add(new Card('h','4'));
		Cardset temp = new Cardset(8);
		temp.add(new Card('s','3'));
		temp.add(new Card('h','3'));
		temp.add(new Card('c','3'));
		temp.add(new Card('d','3'));
		temp.add(new Card('s','A'));
		temp.add(new Card('h','A'));
		temp.add(new Card('s','4'));
		temp.add(new Card('h','4'));
		aaaabbcc.lessPriorityThan(cardset);
		assertEquals(aaaabbcc.lessPriorityThan(temp), false);
	}
}
